<template>
  <div class="ruzhu">
    <el-form :model="dataForm" ref="dataForm" label-width="80px">
      <el-row>
        <el-col :span="9">
          <el-card shadow="hover" style="margin-bottom: 15px;">
            <div slot="header" class="clearfix"><span>订价信息</span></div>
            <div class="ant-card-body">
              <el-form-item label="入住类型" prop="checkinType">
                <el-select v-model="dataForm.checkinType" @change="checkinTypeChange" placeholder="请选择">
                  <el-option label="全天" :value="0"></el-option>
                  <el-option label="时租" :value="1"></el-option>
                  <el-option label="自用" :value="2"></el-option>
                  <el-option label="免费" :value="3"></el-option>
                  <el-option label="长包" :value="4"></el-option>
                </el-select>
              </el-form-item>
              <el-form-item label="预抵时间" prop="arrivalsTime">
                <el-row>
                  <el-col :span="12">
                    <el-date-picker style="width: 100%;" :clearable="false" :picker-options="pickerOptions2" @change="stopDate1Change"
                      v-model="date.startDate1" value-format="yyyy-MM-dd" type="date" placeholder="选择日期"></el-date-picker>
                  </el-col>
                  <el-col :span="12">
                    <el-time-select style="width: 120px;margin-left: 5px;" @change="stopDate1Change(date.startDate1)" :clearable="false" v-model="date.startDate2"
                      :picker-options="{
                        start: '00:00',
                        step: '00:01',
                        end: '23:55'
                      }"
                      placeholder="选择时间"></el-time-select>
                  </el-col>
                </el-row>
              </el-form-item>
              <el-form-item label="预离时间" prop="predissociationTime" v-if="dataForm.checkinType != 1">
                <el-row>
                  <el-col :span="12">
                    <el-date-picker style="width: 100%;" :clearable="false" v-model="date.stopDate1" value-format="yyyy-MM-dd"
                      @change="stopDate2Change" :picker-options="pickerOptions" type="date" placeholder="选择日期"></el-date-picker>
                  </el-col>
                  <el-col :span="12">
                    <el-time-select style="width: 120px;margin-left: 5px;" :clearable="false" v-model="date.stopDate2"
                      :picker-options="{
                        start: '00:00',
                        step: '00:5',
                        end: '23:55'
                      }"
                      placeholder="选择时间"></el-time-select>
                  </el-col>
                </el-row>
              </el-form-item>
              <el-form-item label="时长" prop="days" v-if="dataForm.checkinType == 1">
                <el-select v-model="dataForm.housId" @change="hoursChange" placeholder="请选择">
                  <el-option v-for="item in options.housOptions" :key="item.id" :label="item.name" :value="item.id"></el-option>
                </el-select>
              </el-form-item>
              <el-form-item label="客人来源" prop="checkinType">

                <el-select v-model="dataForm.sourceAgreenid" @change="getschemelist()" placeholder="请选择">
                  <el-option v-for="item in userly" :key="item.id" :label="item.label" :value="item.id">
                  </el-option>
                </el-select>
              </el-form-item>
              <el-form-item label="早餐">
                <el-input-number :min="0" v-model="dataForm.zc" :step="1" step-strictly></el-input-number>
              </el-form-item>
              <el-form-item label="天数" v-if="dataForm.checkinType != 1">
                <el-input-number @change="daysChange" :min="1" v-model="dataForm.days" :step="1" step-strictly></el-input-number>
              </el-form-item>
              <el-form-item label="客人类型" prop="sourceType">
                <el-row>
                  <el-col :span="6">
                    <el-select v-model="dataForm.sourceType" @change="changsourcetype" placeholder="请选择">
                      <el-option v-for="item in sourceTypeOptions" :key="item.value" :label="item.label" :value="item.value"></el-option>
                    </el-select>
                  </el-col>
                  <el-col :span="8" style="margin-left: 10px;">
                    <el-select clearable v-if="dataForm.sourceType == 1" @change="sellerMenberChange" v-model="dataForm.sourceName"
                      filterable remote reserve-keyword placeholder="姓名/手机号/身份证号" :remote-method="remoteMethod"
                      :loading="loading">
                      <el-option v-for="item in options.sellerMenberOp" :key="item.id" :label="item.name" :value="item.id"></el-option>
                    </el-select>
                    <!--                    <el-input v-if="dataForm.sourceType == 2 || dataForm.sourceType == 3" v-model="dataForm.sourceName" placeholder="名称/简称/联系人"></el-input>
 -->
                    <el-input v-if="dataForm.sourceType == 3" v-model="dataForm.sourceName" placeholder="名称/简称/联系人"></el-input>
                    <el-select clearable v-if="dataForm.sourceType == 2" @change="sellerxieyiChange" v-model="dataForm.sourceName"
                      filterable remote reserve-keyword placeholder="名称/编号/手机号" :remote-method="sellerxieyiChange"
                      :loading="loading">
                      <el-option v-for="item in listrestaurantsa" :key="item.values" :label="item.value" :value="item.values"></el-option>
                    </el-select>
                  </el-col>
                  <el-col :span="8" style="margin-left: 10px;" v-if="dataForm.sourceType == 2">
                    <span style="color: red;" @click="showagreement=true">{{agreemxyrows.name}}</span>
                  </el-col>
                </el-row>
              </el-form-item>
              <el-form-item label-width="0" v-if="dataForm.sourceType == 2">
                <div class="customerSourceBar" style="margin-bottom: 0;">
                  <div>
                    <div class="in_block">
                      <label class="fourChar">姓名:</label>
                      <span v-cloak>{{rename}}</span>
                    </div>
                    <div class="in_block">
                      <label>电话:</label>
                      <label>{{retel}}</label>
                    </div>
                    <div class="in_block">
                      <label class="fourChar">余额:</label>
                      <span>{{recha}}</span>
                    </div>
                  </div>
                  <div>
                    <div class="in_block">
                      <label>预收款:</label>
                      <span>{{reyshouk}}</span>
                    </div>
                    <div class="in_block">
                      <label class="threeChar">已结算:</label>
                      <span>{{reyjs}}</span>
                    </div>
                    <div class="in_block">
                      <label class="threeChar">未结算:</label>
                      <span>{{reweijs}}</span>
                    </div>
                  </div>
                </div>
              </el-form-item>
              <el-form-item label-width="0" v-if="dataForm.sourceType == 1">
                <div class="customerSourceBar" style="margin-bottom: 0;">
                  <div>
                    <div class="in_block">
                      <label class="fourChar">姓名:</label>
                      <label>{{ selectSellerMenber.name }}</label>
                    </div>
                    <div class="in_block">
                      <label>电话:</label>
                      <label>{{ selectSellerMenber.tel }}</label>
                    </div>
                    <div class="in_block">
                      <label class="fourChar">级别:</label>
                      <label>{{ selectSellerMenber.levelName }}</label>
                    </div>
                  </div>
                  <div>
                    <div class="in_block">
                      <label>储值:</label>
                      <label>{{ selectSellerMenber.balance }}</label>
                    </div>
                    <div class="in_block">
                      <label class="threeChar">积分:</label>
                      <label>{{ selectSellerMenber.score }}</label>
                    </div>
                    <div class="in_block">
                      <label class="threeChar">卡号:</label>
                      <label>{{ selectSellerMenber.cardJustNo }}</label>
                    </div>
                  </div>
                </div>
              </el-form-item>
              <el-form-item label="房价方案" v-if="dataForm.checkinType != 1">
                <el-select @clear="handleSelect" clearable @change="handleSelect" v-model="dataForm.schemeId"
                  filterable remote reserve-keyword placeholder="名称/编号/手机号" :remote-method="querySearchAsync" :loading="dataListLoading">
                  <el-option v-for="item in listrestaurants" :key="item.id" :label="item.value" :value="item.id"></el-option>
                </el-select>
                <!-- <el-input v-model="dataForm.roomId" style="width: 200px;" placeholder="房间号"></el-input>
                                  <el-input v-model="dataForm.userid" style="width: 200px;" placeholder="用户"></el-input> -->
                <!--                                <el-autocomplete @change="handleSelect"  v-model="dataForm.sa" style="width: 220px;" :fetch-suggestions="querySearchAsync" placeholder="请输入内容" @select="handleSelect"></el-autocomplete>
 -->
              </el-form-item>
            </div>
          </el-card>
          <el-card shadow="hover" style="">
            <div slot="header" class="clearfix"><span>其他信息</span></div>
            <div class="ant-card-body">
              <el-row>
                <el-col :span="12">
                  <el-form-item label="联系人" prop="reserveName">
                    <el-input v-model="dataForm.reserveName" placeholder="必填"></el-input>
                  </el-form-item>
                </el-col>
                <el-col :span="12">
                  <el-form-item label="电话">
                    <el-input v-model="dataForm.reserveTel" placeholder="电话"></el-input>
                  </el-form-item>
                </el-col>
              </el-row>
              <el-row>
                <el-col :span="12">
                  <el-form-item label="担保方式">
                    <el-select v-model="dataForm.guaranteeType" placeholder="请选择">
                      <el-option v-for="item in guaranteeTypeOptions" :key="item.value" :label="item.label" :value="item.value"></el-option>
                    </el-select>
                  </el-form-item>
                </el-col>
                <el-col :span="12">
                  <!--   <el-form-item label="销售员"><el-input v-model="dataForm.saleId" placeholder="销售员"></el-input></el-form-item> -->
                  <el-select v-model="dataForm.saleId" filterable clearable placeholder="销售员">
                    <el-option v-for="item in tmarketingList" :key="item.id" :label="item.name" :value="item.id">
                    </el-option>
                  </el-select>
                </el-col>
              </el-row>
              <el-form-item label="外部单号">
                <el-input v-model="dataForm.externalNo" placeholder="外部单号"></el-input>
              </el-form-item>
              <el-form-item label="备注">
                <el-input v-model="dataForm.remarks" placeholder="备注" type="textarea" :rows="2"></el-input>
              </el-form-item>
            </div>
          </el-card>
        </el-col>
        <el-col :span="15">
          <el-card shadow="hover" style="margin-bottom: 15px;">
            <div slot="header" class="clearfix"><span>选择房间</span></div>
            <div class="ant-card-body" v-loading="roomLoading" :element-loading-text="$t('Common.LoadingText')">
              <div class="title_day_price clear_float">
                <div class="pull">
                  <div style="cursor: pointer;">
                    <!--                    <div class="in_block">
                      <span>房间数：</span>
                      <span>{{ addRoomsList.length }}间</span>
                    </div> -->
                    <div class="in_block">
                      <span>占房天数：</span>
                      <span>{{ dataForm.roomsDays }}晚</span>
                    </div>
                    <div class="in_block">
                      <span>总价：</span>
                      <span class="red_color1">￥ {{ dataForm.totalPrice.toFixed(2) }}</span>
                    </div>
                  </div>
                </div>
                <!-- <div class="push"><el-button type="danger" size="small" @click="addRoomsBtn">添加房间</el-button></div> -->
              </div>
              <el-table :data="reserveList" style="width: 100%">
                <el-table-column type="expand">
                  <template slot-scope="props">
                    <div class="ant-row-flex j_c_s">
                      <div class="" style="flex: 1 1 0%;">
                        <div class="ant-row-flex">
                          <div class="" style="flex: 1 1 0%;line-height: 35px;">
                            <label style="vertical-align: middle;" class="bold">已排房:</label>
                            <span v-if="props.row.roomList.length == 0">空空如也</span>
                            <el-tag size="small" :key="tag.index" v-for="tag in props.row.roomList" closable
                              :disable-transitions="false" @close="roomTagClose(tag, props.row.roomList)" style="margin-right: 5px;">
                              {{ tag.roomSign }}{{ tag.roomNum }}
                            </el-tag>
                          </div>
                        </div>
                      </div>
                      <div style="margin-top: 10px;">
                        <label class="bold">未排房:</label>
                        <span>{{ props.row.alreadyCount - props.row.roomList.length }}间</span>
                      </div>
                    </div>
                  </template>
                </el-table-column>
                <el-table-column align="center" label="房型" prop="name"></el-table-column>
                <el-table-column align="center" label="优惠价 / 门市价">
                  <template slot-scope="scope">
                    <div v-if="!scope.row.roomPrices.hoursMoney" style="color: red;">
                      不支持此时长
                    </div>
                    <div v-else>
                      <label>{{ scope.row.roomPrices.dateList[0][date.startDate1] }}</label>
                      <el-popover v-if="dataForm.checkinType != 1" placement="bottom" @show="editRoomPrice(scope.row)"
                        trigger="hover">
                        <!-- 新版-->
                        <!-- 新版-->
                        <div class="ant-popover-inner-content">
                          <div class="recent_price_ul table_recent_price_ul">
                            <table>
                              <thead>
                                <tr>
                                  <th>
                                    <div class="list_box clear_float"><span>批量改价</span></div>
                                  </th>
                                  <th>
                                    <div class="list_box clear_float">
                                      <span style="width: 100%;">价格</span>
                                    </div>
                                  </th>
                                </tr>
                              </thead>
                              <tbody>
                                <tr>
                                  <td style="text-align: center; position: relative;">
                                    <div class="list_box clear_float" style="position: absolute; top: 0px; bottom: 0px;"><span>
                                        <div>每日房价</div>
                                        <div>
                                          <el-input-number @change="piliangChengPriceHead" v-model="editPriceSync.price"
                                            size="mini" :precision="2" :step="100" :min="0"></el-input-number>
                                        </div>
                                      </span>
                                    </div>
                                  </td>
                                  <td>
                                    <div class="list_box clear_float">
                                      <span v-for="(priceItem, index) in setPrice.roomPrices.dateList" v-if="index < dataForm.days"
                                        :key="setPrice.roomId + ':' + index">
                                        <div>{{dateList[index]}}</div>
                                        <div style="margin-bottom: 6px;">
                                          <el-input-number size="mini" @change="changeTotal(priceItem,index,priceItem[dateList[index]],setPrice)"
                                            v-model="priceItem[dateList[index]]" :precision="2" :step="100" :min="0"></el-input-number>

                                        </div>
                                        <div>/ {{ dataForm.checkinType === 0 ? scope.row.oprice : scope.row.roomPrices.dateList[0][date.startDate1] }}</div>
                                      </span>
                                    </div>
                                  </td>
                                </tr>
                              </tbody>
                            </table>
                          </div>
                        </div>

                        <!-- 旧版-->
                        <!-- <el-form label-width="100px" :inline="true" style="max-height: 300px !important;overflow-y: auto;">
                          <el-form-item v-for="(item, index) in setPrice.roomPrices.dateList" v-if="index < dataForm.days"
                            :key="setPrice.roomId + ':' + index" :label="dateList[index]">
                            <el-input @change="changeTotalPrice(reserveList)" style="100px" size="small" v-model="item[dateList[index]]"
                              placeholder="金额"></el-input>
                          </el-form-item>
                        </el-form> -->
                        <i class="el-icon-edit" slot="reference" style="cursor: pointer;"></i>
                      </el-popover>
                      <!-- <i class="el-icon-edit" slot="reference" @click="editRoomPrice(item)" style="cursor: pointer;"></i> -->
                      <span style="margin-left: 5px; margin-right: 5px;">/</span>
                      <label>{{ dataForm.checkinType === 0 ? scope.row.oprice : scope.row.roomPrices.dateList[0][date.startDate1] }}</label>
                    </div>
                  </template>
                </el-table-column>

                <el-table-column align="center" label="可订数" prop="reserveCount"></el-table-column>
                <el-table-column align="center" label="预定间数" prop="alreadyCount">
                  <template slot-scope="scope">
                    <el-input-number @change="changebyid(reserveList,scope.row.id)" v-model="scope.row.alreadyCount"
                      :min="0" size="small" :max="scope.row.reserveCount" :step="1" step-strictly></el-input-number>
                  </template>
                </el-table-column>
                <el-table-column align="center" label="操作">
                  <template slot-scope="scope">
                    <el-button size="mini" @click="paiFangBtn(scope.$index, scope.row)">排房</el-button>
                  </template>
                </el-table-column>
              </el-table>
            </div>
          </el-card>
        </el-col>
      </el-row>
      <div class="ant-layout-footer">
        <!-- <el-button @click="visible = false">{{ $t('Common.Cancel') }}</el-button> -->
        <!-- <el-checkbox v-model="printDengjiDan" style="margin-right: 10px;">打印入住登记单</el-checkbox> -->
        <el-button type="danger" @click="dataFormSubmit">预 定</el-button>
      </div>
    </el-form>

    <!-- 价格弹窗 -->
    <el-dialog title="价格修改" :visible.sync="priceVisible" :append-to-body="true">
      <el-form label-width="100px">
        <el-form-item v-for="(item, index) in setPrice.roomPrices.dateList" v-if="index < dataForm.days" :key="setPrice.roomId + ':' + index"
          :label="dateList[index]">
          <el-input size="small" v-model="item[dateList[index]]" placeholder="金额"></el-input>
        </el-form-item>
      </el-form>
      <span slot="footer">
        <el-button @click="priceVisible = false">取消</el-button>
        <el-button type="primary" @click="dataFormSubmit()">{{ $t('Common.Confirm') }}</el-button>
      </span>
    </el-dialog>

    <el-dialog title="选择协议" :visible.sync="showagreement" v-if="showagreement" :append-to-body="true">
      <el-table :data="agreementdataList" border="" v-loading="dataListLoadingsa" style="width: 100%;">
        <el-table-column type="selection" header-align="center" align="center" width="80"></el-table-column>
        <el-table-column prop="typeName" header-align="center" align="center" label="协议类型"></el-table-column>
        <el-table-column prop="name" header-align="center" align="center" label="协议主题"></el-table-column>
        <!--        	<el-table-column prop="khSigning" header-align="center" align="center" label="客户签约人"></el-table-column>
            	<el-table-column prop="bsSigning" header-align="center" align="center" label="本司签约人"></el-table-column> -->
        <el-table-column prop="no" header-align="center" align="center" label="协议单号"></el-table-column>
        <el-table-column prop="qyTime" header-align="center" align="center" label="签约时间"></el-table-column>
        <el-table-column prop="discount" header-align="center" align="center" label="折扣值"></el-table-column>
        <!--    	<el-table-column prop="operation" header-align="center" align="center" label="操作人"></el-table-column>
            	<el-table-column prop="updateTime" header-align="center" align="center" label="更新时间"></el-table-column>
            	<el-table-column prop="a" header-align="center" align="center" label="协议房价">
            		<template slot-scope="scope">
            			<el-button type="primary" @click="agreedrate(scope.row)">协议房价</el-button>
            		</template>
            	</el-table-column> -->

        <el-table-column fixed="right" header-align="center" align="center" width="150" label="操作">
          <template slot-scope="scope">
            <el-button type="text" size="small" @click="updateAgerembyxieyi(scope.row)">选择</el-button>
          </template>
        </el-table-column>
      </el-table>
      <el-pagination @size-change="sizeChangeHandle" @current-change="currentChangeHandle" :current-page="pageIndex"
        :page-sizes="[10, 20, 50, 100]" :page-size="pageSize" :total="agreementpagesum" layout="total, sizes, prev, pager, next, jumper"></el-pagination>
    </el-dialog>


    <!-- 选择房间-->
    <reserveRoomSelect v-if="reserveRoomSelectVisible" ref="reserveRoomSelect" @refreshDataList="refreshPaiFangList"></reserveRoomSelect>
  </div>
</template>

<script>
  import moment from 'moment';
  import reserveRoomSelect from './reserve-room-select';
  export default {
    data() {
      return {
        editPriceSync: {
          floorRoomId: 0,
          piliang: false,
          price: '',
        },
        changePriceSync: [{
          floorRoomId: 0,
          piliang: false,
          price: 0,
        }],
        printDengjiDan: false,
        roomLoading: false,
        selectMenberFlag: false,
        selectSellerMenber: {},
        loading: false,
        yajinPrice: 0,
        authPrice: 0,
        yushouPrice: 0,
        newPrice: {},
        setPrice: {
          roomPrices: {
            dateList: []
          }
        },
        reserveRoomSelectVisible: false,
        priceVisible: false,
        // 押金类型为现付（0AR帐1现金2储值卡3积分兑换4银行卡5支付宝6微信）
        options: {
          sellerMenberOp: [],
          housOptions: [],
          paysTypeOptions: [],
          peopleTypeOptions: [
            // 身份类型（0居民身份证1户口簿2军官证3警官证4士兵证5护照6其他）
            {
              label: '居民身份证',
              value: '0'
            },
            {
              label: '户口簿',
              value: '1'
            },
            {
              label: '军官证',
              value: '2'
            },
            {
              label: '警官证',
              value: '3'
            },
            {
              label: '士兵证',
              value: '4'
            },
            {
              label: '护照',
              value: '5'
            },
            {
              label: '其他',
              value: '6'
            }
          ]
        },
        nowpays: [{
          nowType: '',
          payPrice: '',
          state: 2
        }],
        yunowpays: [{
          bankNumber: '',
          code: '',
          state: 2,
          payPrice: ''
        }],
        paysActiveName: 'first',
        // （0散客1会员2协议单位3中介）
        pickerOptions: {
          disabledDate(time) {
            return time.getTime() < Date.now();
          }
        },
        pickerOptions2: {
          disabledDate(time) {
            return time < moment().add(-1, "days");
          }
        },
        oldReserveList: [],
        addRoomsList: [],
        zidingyiSwitch: false,
        ruzhuZhang: true,
        sourceTypeOptions: [{
            label: '散客',
            value: 0
          },
          {
            label: '会员',
            value: 1
          },
          {
            label: '协议单位',
            value: 2
          },
          {
            label: '中介',
            value: 3
          }
        ],
        guaranteeTypeOptions: [{
            label: '无担保',
            value: 0
          },
          {
            label: '有担保',
            value: 1
          },
          {
            label: 'OTA担保',
            value: 2
          }
        ],
        roomDayRule:{},
        date: {
          startDate1: moment().format('YYYY-MM-DD'),
          startDate2: '18:00',
          stopDate1: moment()
            .add(1, 'days')
            .format('YYYY-MM-DD'),
          stopDate2: '12:00'
        },
        housOptions: [],
        item: {},
        selRow: {
          index: 0,
          row: {}
        },
        visible: false,
        dateList: [],
        reserveList: [],
        dataForm: {
          sa: '',
          schemeId: '',
          housId: '',
          sellerId: '',
          userId: '',
          memberId: '',
          reserveName: '',
          reserveTel: '',
          checkinType: 0,
          arrivalsTime: '',
          predissociationTime: '',
          days: 1,
          sourceType: 0,
          sourceName: '',
          activityId: '',
          guaranteeType: 0,
          saleId: '',
          externalNo: '',
          remarks: '',
          roomsNum: 0,
          roomsDays: 1,
          totalPrice: 0.0,
          creatTime: '',
          sourceAgreenid: '',
          zc: 0,
          agreemId: '',
          agreemCustomerId: '',
          agreemId: ''

        },
        agreementFrom: {
          name: undefined,
          limit: undefined,
          page: undefined,
          agreementId: undefined
        },
        userly: [],
        agreementdataList: [],
        showagreement: false,
        dataListLoading: false,
        agreementpagesum: 0,
        reindex: '',
        pageIndex: 1,
        pageSize: 10,
        rename: '',
        retel: '',
        recha: '',
        reyshouk: '',
        reweijs: '',
        reyjs: '',
        agreemxyrows: {},
        dataListLoadings: false,
        listrestaurants: [],
        listrestaurantsa: [],
        restaurants: [],
        tmarketingList: [],
        itemso: '',
        restaurantsquert: [],
        dataListLoadingsa: false,
        dataRule: {
          reserveName: [{
            required: true,
            message: '联系人不能为空',
            trigger: 'blur'
          }]
        }
      };
    },
    activated() {
      if (this.reserveList.length == 0) {
        if (this.$cookie.get('reserve')) {
          this.init(JSON.parse(this.$cookie.get('reserve')));
        } else {
          this.init([]);
        }
      }
    },
    components: {
      reserveRoomSelect
    },
    methods: {
      changsourcetype() {
        if (this.dataForm.sourceType == '0') {

          this.stopDate1Change();
        }
        this.getchemelist();
      },
      updateAgerembyxieyi(row) {
        this.agreemxyrows = row;
        this.getxieyimoney(this.reserveList, row.id);
        this.dataForm.agreemCustomerId = row.id;
        this.showagreement = false;
      },
      getxieyimoney(addRoomsList, id) {
        var rooids = '';
        for (var i = 0; i < addRoomsList.length; i++) {
          rooids += addRoomsList[i].id + ",";
        }
        if (1!=1) {
          this.changescheme(this.dataForm.schemeId);
        } else {
          this.$http({
            url: this.$http.adornUrl('/hotel/tagreementpricelist/getxieyimoney'),
            method: 'get',
            params: this.$http.adornParams({
              floorRoomId: rooids,
              customerId: id,
            })

          }).then(({
            data
          }) => {
            if (data && data.code === 0) {
              var money = 0;
              this.reserveList.forEach((item, index) => {
                if (item.alreadyCount > 0) {
                  var arr = item.roomPrices.dateList;
                  var prices = item.roomPrices
                  for (var s = 0; s < data.page.length; s++) {
                    if (data.page[s].floorRoomId == item.id) {

                      console.log("协议房价房型信息",data.page[s])

                      this.dataForm.zc = data.page[s].zcnumber;

                      for (var i = 0; i < this.dataForm.days; i++) {
                        arr[i][this.dateList[i]] = data.page[s].xymoney;
                        money += data.page[s].xymoney * item.alreadyCount;
                        prices[this.dateList[i]] = data.page[s].xymoney;
                      }
                    }
                  }
                }
              });
              this.dataForm.totalPrice = money;

              this.changeTotalPrice(this.reserveList);
            } else {
              this.dataForm.totalPrice = 0;
            }
          });
        }

      },
      sizeChangeHandle(val) {
        this.pageSize = val;
        this.pageIndex = 1;
        this.getagreementByxieyi();
      },
      // 当前页
      currentChangeHandle(val) {
        this.pageIndex = val;
        this.getagreementByxieyi();
      },
      sellerxieyiChange(value) {
        this.listrestaurantsa = [];
        console.log(value);
        var restaurants = this.restaurants;
        for (var i = 0; i < this.restaurants.length; i++) {
          var demo = restaurants[i].values;
          if (demo.indexOf(value) != -1) {
            this.dataListLoading = true;
            this.dataForm.agreemId = restaurants[i].id
            this.getagreementByxieyi();
            this.rename = this.restaurants[i].name;
            this.retel = this.restaurants[i].tel;
            this.recha = this.restaurants[i].cha;
            this.reyshouk = this.restaurants[i].yshouk;
            this.reweijs = this.restaurants[i].wejies;
            this.reyjs = this.restaurants[i].yjs;
            this.listrestaurantsa.push(restaurants[i]);
          }
        }
      },
      getagreementByxieyi() {
        this.agreementFrom.agreementId = this.dataForm.agreemId;
        this.agreementFrom.limit = this.pageSize;
        this.agreementFrom.page = this.pageIndex;
        this.$http({
          url: this.$http.adornUrl('/hotel/agreement-customer/list'),
          method: 'get',
          params: this.agreementFrom
        }).then(({
          data
        }) => {
          if (data && data.code === 0) {

            this.agreementdataList = data.page.list;
            this.agreementpagesum = data.page.sum;
            this.showagreement = true;
            this.dataListLoadingsa = false;
          } else {
            this.agreementdataList = [];
            this.agreementpagesum = 0;
          }
          this.dataListLoadingsa = false;
        });

      },
      getList() {

        this.$http({
          url: this.$http.adornUrl('/hotel/agreement/shareGetDropDown'),
          method: 'get',
          params: this.$http.adornParams({
            share:3
          })
        }).then(({
          data
        }) => {

          this.restaurants = data.list;
          this.listrestaurantsa = data.list;
        });

      },

      getDataListtmark() {
        this.$http({
          url: this.$http.adornUrl('/hotel/tmarketingmanagement/list'),
          method: 'get',
          params: this.$http.adornParams({
            'page': 1,
            'limit': 9999,
            'status': '1',
          })
        }).then(({
          data
        }) => {
          if (data && data.code === 0) {
            this.tmarketingList = data.page.list
          } else {
            this.tmarketingList = []
          }
        })
      },
      getagreementType(type) {
        this.$http({
          url: this.$http.adornUrl('/hotel/thotelagreementtype/list'),
          method: 'get',
          params: this.$http.adornParams({
            page: 1,
            limit: 999,
            type: type
          })
        }).then(({
          data
        }) => {
          if ("userly" == type) {
            this.userly = data.page.list;
            if (this.userly.length == 0) {
              this.$message({
                showClose: true,
                message: '请设置客人来源',
                type: 'error'
              });
            } else {
              this.dataForm.sourceAgreenid = this.userly[0].id;
              this.getschemelist();
            }
          } else {
            this.documenttypelist = data.page.list;
          }
        });
      },
      handleSelect() {
        if (this.dataForm.schemeId == '') {
          this.stopDate1Change();
        }
        this.getchemelist();


      },
      querySearchAsync(value) {
        this.listrestaurants = [];
        console.log(value);
        var restaurants = this.restaurantsquert;
        for (var i = 0; i < restaurants.length; i++) {
          var demo = restaurants[i].label;
          if (demo.indexOf(value) != -1) {
            this.dataListLoading = true;
            this.listrestaurants.push(restaurants[i]);
          }

        }
        if (value == '') {
          this.listrestaurants = this.restaurantsquert;
        }
        this.dataListLoading = false;

      },
      getchemelist() {
        console.log("测试================" + this.date.startDate1)
        this.$http({
          url: this.$http.adornUrl('/hotel/thotelfloorschemeroomjl/getchemelist'),
          method: 'get',
          params: this.$http.adornParams({
            page: 1,
            limit: 999,
            schemeId: this.dataForm.schemeId,
            datas: this.date.startDate1,
            day: this.dataForm.days
          })
        }).then(({
          data
        }) => {
          if (data && data.code === 0) {
            for (var i = 0; i < this.reserveList.length; i++) {
              var demo = this.reserveList[i];
              for (var s = 0; s < data.page.length; s++) {
                if (parseInt(data.page[s].roomId) == demo.id) {
                  demo.roomPrices[data.page[s].datas] = data.page[s].datamoney;
                  demo.roomPrices.dateList = data.page[s].list;

                }
              }

            }

            var money = 0;
            if (this.dataForm.checkinType == 0) {
              this.reserveList.forEach((item, index) => {
                var arr = item.roomPrices.dateList;
                for (var i = 0; i < this.dataForm.days; i++) {
                  console.log("测试" + this.dateList[i]);
                  money += parseFloat(arr[i][this.dateList[i]]) * item.alreadyCount;
                }
              });
            }
            this.dataForm.totalPrice = money;
            console.log("测试6666" + this.reserveList)
          }
        });
      },
      getschemelist() {
        this.$http({
          url: this.$http.adornUrl('/hotel/thotelfloorscheme/listArrayyd'),
          method: 'get',
          params: this.$http.adornParams({
            page: 1,
            limit: 999,
            type: this.dataForm.sourceAgreenid
          })
        }).then(({
          data
        }) => {
          if (data && data.code === 0) {
            this.restaurantsquert = data.page.list;
            this.listrestaurants = data.page.list;
          } else {
            this.restaurantsquert = [];
            this.listrestaurants = [];
          }
        });

      },
      changebyid(list, id) {
        this.itemso = id;
        if (this.dataForm.schemeId != '') {
          this.getchemelist();
        } else if (this.dataForm.agreemCustomerId != '') {
          this.getxieyimoney(this.reserveList, this.agreemxyrows.id);
        } else {
          this.changeTotalPrice(list);
        }


      },

      roomTagClose(tag, list) {
        list.splice(list.indexOf(tag), 1);
      },
      async init(list) {
        this.getdateList();
        this.getroomhours();
        this.searchRoomPriceGuiZe();
        this.getagreementType('userly');
        this.getDataListtmark();
        this.getList();
        this.getReserveList();
        this.$nextTick(() => {
          var that = this;
          setTimeout(function() {
            that.refreshRoomList(list);
          }, 500);
        });
      },
      //查询全天房计费规则
      searchRoomPriceGuiZe() {
        this.$http({
          url: this.$http.adornUrl('/hotel/thotelfloorroomdayrule/seller'),
          method: 'get',
          params: this.$http.adornParams({})
        }).then(({
          data
        }) => {
          if (data && data.code === 0) {
            console.log(data);
            this.roomDayRule = data.tHotelFloorRoomDayRule
            this.date.stopDate2 = data.tHotelFloorRoomDayRule.exitPoint
          } else {
            this.roomDayRule = {};
          }
        });
      },
      refreshPaiFangList(arr) {},
      async refreshRoomList(val) {
        console.log(val);
        //预定列表赋值
        this.reserveList.forEach(item => {
          val.forEach(item2 => {
            console.log(item2.roomId == item.id)
            if (item2.roomId == item.id) {
              item.alreadyCount = item.alreadyCount + 1
              if (item2.floorRoomEntity) {
                item.roomList.push({
                  ...item2.floorRoomEntity,
                })
              }
              this.$forceUpdate()
            }
          });


        })
        if (this.dataForm.checkinType == 1) {
          if (!this.dataForm.housId) {
            if (this.options.housOptions.length > 0) {
              this.dataForm.housId = this.options.housOptions[0].id;
            } else {
              this.$message.error('请设置钟点房计费规则');
            }
          }
          this.reqRoomHoursPrice(this.reserveList);
        }
        if (this.dataForm.checkinType == 0) {
          this.reqRoomPrice(this.reserveList);
        }
        if (this.dataForm.schemeId != '') {
          this.getchemelist();
        }



      },
      paiFangBtn(index, row) {
        this.selRow.index = index;
        this.selRow.row = row;
        this.reserveRoomSelectVisible = true;
        this.$nextTick(() => {
          this.$refs.reserveRoomSelect.init(index, row, this.date.startDate1 + ' ' + (this.date.startDate2 ? this.date.startDate2 : '18:00'), this.date.stopDate1 + ' ' +
            this.date.stopDate2);
        });
      },
      //获取预定列表
      async getReserveList() {
        this.roomLoading = true;
        this.$http({
          url: this.$http.adornUrl(`/hotel/thotelfloorroomcheckinsingle/view_list`),
          method: 'get',
          params: this.$http.adornParams({
            startDate: this.date.startDate1 + ' '+ (this.date.startDate2 ? this.date.startDate2 : '18:00'),
            endDate: this.date.stopDate1 + ' ' + this.date.stopDate2,
            classify: 1
          })
        }).then(({
          data
        }) => {
          if (data && data.code === 0) {
            console.log(data);
            this.reserveList = data.data.map(item => ({
              ...item,
              roomList: [],
              roomPrices: {
                dateList: []
              }
            }));
            console.log(this.reserveList)
          } else {
            this.$message.error(data.msg);
          }
          this.roomLoading = false;
        });
      },
      //获取可定列表
      getReserveCountList() {
        this.roomLoading = true;
        this.$http({
          url: this.$http.adornUrl(`/hotel/thotelfloorroomcheckinsingle/view_list`),
          method: 'get',
          params: this.$http.adornParams({
            startDate: this.date.startDate1 + ' '+ (this.date.startDate2 ? this.date.startDate2 : '18:00'),
            endDate: this.date.stopDate1 + ' ' + this.date.stopDate2,
            classify: 1
          })
        }).then(({
          data
        }) => {
          if (data && data.code === 0) {
            for (var i = 0; i < data.data.length; i++) {
              this.reserveList[i].reserveCount = data.data[i].reserveCount
            }

            this.$forceUpdate();
          } else {
            this.$message.error(data.msg);
          }
          this.roomLoading = false;
        });
      },
      sellerMenberChange(value) {
        console.log(value);
        var arr = this.options.sellerMenberOp.filter(item => item.id == value);
        this.selectSellerMenber = arr[0];
        this.selectMenberFlag = true;
        if (this.reserveList.length > 0) {
          this.changePriceSync = [{
            floorRoomId: 0,
            piliang:false,
            price:0,
          }];
          this.reqRoomPrice(this.reserveList);
        }
      },
      remoteMethod(query) {
        if (query !== '') {
          this.loading = true;
          this.$http({
            url: this.$http.adornUrl('/hotel/hotelmemberleveldetail/shareList'),
            method: 'get',
            params: this.$http.adornParams({
              page: 1,
              limit: 999,
              share:1,
              ruzhuQuery: query
            })
          }).then(({
            data
          }) => {
            if (data && data.code === 0) {
              console.log(data);
              this.options.sellerMenberOp = data.page.records;
            } else {
              this.options.sellerMenberOp = [];
            }
            this.loading = false;
          });
        } else {
          this.options.sellerMenberOp = [];
        }
      },

      async piliangChengPriceHead(val) {
        if ('' == val) {
          this.editPriceSync.piliang = false;
        } else {
          this.editPriceSync.piliang = true;
          var dateList = this.setPrice.roomPrices.dateList
          dateList.forEach((item, index) => {
            for (var key in item) {
              item[key] = val
              this.setPrice.roomPrices[key] = val
            }
          })
          var floorRoomList = await this.changePriceSync.filter(sync => sync.floorRoomId == this.editPriceSync.floorRoomId)
          if (floorRoomList.length > 0) {
            floorRoomList[0] = {}
            floorRoomList[0] = {
              floorRoomId: this.editPriceSync.floorRoomId,
              piliang: this.editPriceSync.piliang,
              price: this.editPriceSync.price,
            }
            console.log("floorRoomList[0]", floorRoomList[0])
          }
          this.changeTotalPrice(this.reserveList);
        }
      },
      async editRoomPrice(item) {
        var floorRoomList = await this.changePriceSync.filter(sync => sync.floorRoomId == item.id)
        if (floorRoomList.length == 0) {
          var entity = {
            floorRoomId: item.id,
            piliang: false,
            price: 0,
            ...item
          }
          this.changePriceSync.push(entity)
          this.editPriceSync = entity
        } else {
          var entity = floorRoomList[0]
          this.editPriceSync = entity
        }
        this.setPrice = {};
        // this.priceVisible = true;
        this.newPrice = item;
        this.setPrice = {
          roomPrices: {
            ...item.roomPrices
          }
        };
      },
      //获取钟点房规则
      getroomhours() {
        this.$http({
          url: this.$http.adornUrl('/hotel/thotelfloorroomhours/list'),
          method: 'get',
          params: this.$http.adornParams({
            page: 1,
            limit: 999
          })
        }).then(({
          data
        }) => {
          if (data && data.code === 0) {
            this.options.housOptions = data.page.list;
          } else {
            this.options.housOptions = [];
          }
        });
      },
      async getBetweenDateAll(begin, end) {
        //计算相差时间
        var startDate = moment(begin);
        var stopDate = moment(end);
        const date3 = stopDate.diff(startDate, 'day'); //计算相差的分钟数
        var arrDate = []
        for (var i = 0; i <= date3; i++) {
          arrDate.push(moment(begin).add(i, "days").format('YYYY-MM-DD'))
        }
        return arrDate;
      },
      async daysChange(val) {
        console.log(val);
        this.date.stopDate1 = moment(this.date.startDate1)
          .add(val, 'days')
          .format('YYYY-MM-DD');
        this.dataForm.roomsDays = val;
        this.dateList = await this.getBetweenDateAll(this.date.startDate1, this.date.stopDate1)
        //记录之前数据
        // this.oldReserveList = this.reserveList
        // this.getReserveList();
        this.getReserveCountList();
        console.log(this.dateList)

        this.$nextTick(() => {
          setTimeout(() => {
            // this.getdateList();
            this.refreshRoomList(this.reserveList);
          }, 10)
        });
      },
      checkinTypeChange(val) {
        if (val == 0) {
          this.refreshRoomList(this.reserveList);
        }
        if (val == 1) {
          if (!this.dataForm.housId) {
            if (this.options.housOptions.length > 0) {
              this.dataForm.housId = this.options.housOptions[0].id;
            } else {
              this.$message.error('请设置钟点房计费规则');
            }
          }
          this.reqRoomHoursPrice(this.reserveList);
        }
      },
      //加载日期
      getdateList() {
        this.dateList = [];
        //加载90天内日期
        for (var i = 0; i < 999; i++) {
          this.dateList.push(
            moment()
            .add(i, 'days')
            .format('YYYY-MM-DD')
          );
        }
      },
      hoursChange(hoursId) {
        console.log(hoursId);
        this.reqRoomHoursPrice(this.reserveList);
      },
      reqRoomHoursPrice(arr) {
        var idArr = [];
        arr.forEach((item, index) => {
          idArr.push(item.id);
        });
        var ids = idArr.join(',');
        this.$http({
          url: this.$http.adornUrl(`/hotel/thotelfloorroomhours/room_hours_money`),
          method: 'get',
          params: this.$http.adornParams({
            startDate: this.date.startDate1,
            endDate: moment()
              .add(1, 'days')
              .format('YYYY-MM-DD'),
            hoursId: this.dataForm.housId,
            roomIds: ids
          })
        }).then(({
          data
        }) => {
          if (data && data.code === 0) {
            console.log(data);
            for (var i = 0; i < this.reserveList.length; i++) {
              data.data.forEach((item, index) => {
                if (item.roomId == this.reserveList[i].id) {
                  let _obj = JSON.stringify(item),
                    objClone = JSON.parse(_obj);
                  this.reserveList[i].roomPrices = objClone;
                  console.log(item);
                }
              });
            }
            this.changeTotalPrice(this.reserveList);
          } else {
            this.$message.error(data.msg);
          }
        });
      },
      async reqRoomPrice(arr) {
        this.roomLoading = true;
        var idArr = [];
        arr.forEach((item, index) => {
          idArr.push(item.id);
        });
        console.log(arr);
        var ids = idArr.join(',');
        this.$http({
          url: this.$http.adornUrl(`/hotel/hotelroomprice/list3`),
          method: 'get',
          params: this.$http.adornParams({
            startDate: this.date.startDate1,
            endDate: this.date.stopDate1,
            ids: ids
          })
        }).then(({
          data
        }) => {
          if (data && data.code === 0) {
            console.log(data);
            for (var i = 0; i < this.reserveList.length; i++) {
              data.data.dataList.forEach((item, index) => {
                if (item.roomId == this.reserveList[i].id) {
                  let _obj = JSON.stringify(item),
                    objClone = JSON.parse(_obj);
                  this.reserveList[i].roomPrices = objClone;
                  console.log(item);
                }
              });
            }


            //会员折扣价
            if (this.selectMenberFlag) {
              this.reserveList.forEach((item, index) => {
                var arr = item.roomPrices.dateList;
                for (var i = 0; i < this.dataForm.days; i++) {
                  arr[i][this.dateList[i]] = (parseFloat(arr[i][this.dateList[i]]) * parseFloat(this.selectSellerMenber
                    .discount)).toFixed(2);
                }
              });
            }

            //查询修改记录
            this.changePriceSync.forEach(async (changePriceEntity, index) => {
              console.log(changePriceEntity)
              var floorRoomList = await this.reserveList.filter(item => item.id == changePriceEntity.floorRoomId);
              if (floorRoomList.length > 0) {
                var priceEntity2 = JSON.parse(JSON.stringify(changePriceEntity))
                delete priceEntity2.floorRoomId;
                var entity = floorRoomList[0]
                var roomPrices = entity.roomPrices
                console.log(roomPrices)
                // var dateList = await this.getGreenPriceList(priceEntity2)
                var dateList2 = await this.getGreenPriceList2(priceEntity2, roomPrices.dateList)
                roomPrices = {
                  ...roomPrices,
                  ...priceEntity2,
                  dateList: dateList2
                }
                floorRoomList[0].roomPrices = roomPrices
                console.log(entity)
                console.log(roomPrices)
              }
            })

            this.$nextTick(() => {
              const _that = this
              setTimeout(() => {
                if (_that.dataForm.schemeId != '') {
                  _that.getchemelist();
                }
                if (_that.agreemxyrows.id) {
                  _that.getxieyimoney(_that.reserveList, _that.agreemxyrows.id);
                }

                if (_that.dataForm.agreemCustomerId == '') {
                  _that.changeTotalPrice(_that.reserveList);
                }

                // if (_that.dataForm.schemeId != '') {
                //   _that.changescheme(_that.dataForm.schemeId)
                // } else {
                //   _that.changeTotalPrice(_that.addRoomsList);
                // }
              }, 10)
            })


          } else {
            this.$message.error(data.msg);
          }
          this.roomLoading = false;
        });
      },
      async changeTotal(item, index, val, setPrice) {
        if (val == '') {
          this.setPrice.roomPrices.dateList[index][this.dateList[index]] = 0;
          val = 0;
        }
        var floorRoomId = this.newPrice.id
        var floorRoomList = await this.changePriceSync.filter(item => item.floorRoomId == floorRoomId)
        if (floorRoomList.length == 0) {
          this.changePriceSync.push({
            floorRoomId: floorRoomId,
            piliang: false,
            price: 0,
            ...item
          })
        } else {
          var entity = floorRoomList[0]
          entity[this.dateList[index]] = val
        }
        this.changeTotalPrice(this.reserveList);
      },
      async getGreenPriceList(priceEntity2) {
        var arr = [];
        for (var key in priceEntity2) {
          var entity = {};
          entity[key] = priceEntity2[key]
          arr.push(entity)
        }
        return arr;
      },
      async getGreenPriceList2(priceEntity2, dateList) {
        var today = moment().format('YYYY-MM-DD')
        dateList.forEach(async (item, index) => {
          for (var key in item) {
            if (undefined != priceEntity2[key]) {
              item[key] = priceEntity2[key]
            } else {
              // if (key != today && undefined != priceEntity2[today]) {
              //   item[key] = priceEntity2[today]
              // }
              if (priceEntity2.price) {
                if (priceEntity2.piliang) {
                  item[key] = priceEntity2.price
                }
              }
            }
          }
        })
        return dateList;
      },
      //计算总金额
      async changeTotalPrice(list) {
        var money = 0;
        if (this.dataForm.checkinType == 0) {
          list.forEach((item, index) => {
            var arr = item.roomPrices.dateList;
            for (var i = 0; i < this.dataForm.days; i++) {
              console.log("测试" + this.dateList[i]);
              money += parseFloat(arr[i][this.dateList[i]]) * item.alreadyCount;
            }
          });
        }

        if (this.dataForm.checkinType == 1) {
          list.forEach((item, index) => {
            var arr = item.roomPrices.dateList;
            money += parseFloat(arr[0][this.dateList[0]]) * item.alreadyCount;
          });
        }


        this.dataForm.totalPrice = money;
      },
      async stopDate1Change(val) {
        var startDate = moment(val);
        var stopDate = moment(this.date.stopDate1);
        const date3 = stopDate.diff(startDate, 'day'); //计算相差的分钟数


        //看看是不是相差一天
        if (date3 <= 0) {
          //预离时间要多加一天
          this.date.stopDate1 = moment(val).add(1, "days").format('YYYY-MM-DD')
          this.dataForm.days = date3;
          this.dataForm.roomsDays = 1;
        } else {
          this.dataForm.days = date3;
          this.dataForm.roomsDays = date3;
        }
        //记录之前数据
        // this.oldReserveList = this.reserveList
        // this.getReserveList();
        this.getReserveCountList();
        this.dateList = await this.getBetweenDateAll(this.date.startDate1, this.date.stopDate1)
        console.log(this.dateList)
        setTimeout(() => {
          // this.getdateList();
          this.refreshRoomList(this.addRoomsList);
        }, 10)

      },
      async stopDate2Change(val) {
        var startDate = moment(this.date.startDate1);
        var stopDate = moment(val);
        const date3 = stopDate.diff(startDate, 'day'); //计算相差的分钟数
        if (date3 <= 0) {
          //预离时间要多加一天
          this.date.startDate1 = moment(val).add(-1, "days").format('YYYY-MM-DD')
          this.dataForm.days = date3;
          this.dataForm.roomsDays = date3;
        } else {
          this.dataForm.days = date3;
          this.dataForm.roomsDays = date3;
        }
        //记录之前数据
        // this.oldReserveList = this.reserveList
        // this.getReserveList();
        this.getReserveCountList();
        this.dateList = await this.getBetweenDateAll(this.date.startDate1, this.date.stopDate1)
        console.log(this.dateList)
        this.$nextTick(() => {
          setTimeout(() => {
            // this.getdateList();
            this.refreshRoomList(this.addRoomsList);
          }, 10)
        });
      },
      toAccounting(item, type, printFlag) {
        //将数据存储到本地
        var p = {
          singleId: item.singleId,
          type: type,
          printFlag: printFlag
        };
        this.$cookie.set('accounting', JSON.stringify(p));
        this.$router.push({
          name: 'accounting'
        });
      },
      // 表单提交
      dataFormSubmit() {
        //检测是否添加房间
        var index = 0;
        this.reserveList.forEach(item => {
          if (item.alreadyCount == 0) {
            index++;
          }
        })
        if (index == this.reserveList.length) {
          this.$message.error('请添加房间');
          return false;
        }
        //检测是否填写联系人
        if (!this.dataForm.reserveName) {
          this.$message.error('联系人不可为空');
          return false;
        }

        //检测是否有不支持预定的类型
        for (var i = 0; i < this.reserveList.length; i++) {
          this.reserveList[i].indexlength = 0;
          this.reserveList[i].index = i;
          var item = this.reserveList[i];
          console.log(item);
          var prices = item.roomPrices;
          //检测选中房间是否有不支持的
          if (!prices.hoursMoney) {
            this.$message.error('当前所选房间不支持办理预定！');
            return false;
          }
        }

        //检测是否有脏房
        if (!this.ruzhuZhang) {
          this.$confirm('预定房型有脏房，是否继续入住?', '提示', {
            confirmButtonText: '确定',
            cancelButtonText: '取消',
            type: 'warning'
          }).then(() => {
            this.ruzhuZhang = true;
            this.dataFormSubmit();
          });
          return false;
        }

        this.$refs['dataForm'].validate(valid => {
          if (valid) {
            this.$http({
              url: this.$http.adornUrl(`/hotel/thotelfloorroomcheckinsingle/reserve`),
              method: 'post',
              data: this.$http.adornData({
                checkinType: this.dataForm.checkinType,
                arrivalsTime: this.date.startDate1 + ' ' + this.date.startDate2,
                predissociationTime: this.date.stopDate1 + ' ' + this.date.stopDate2,
                days: this.dataForm.days,
                housId: this.dataForm.housId,
                totalPrice: this.dataForm.totalPrice,
                sourceType: this.dataForm.sourceType,
                schemeId: this.dataForm.schemeId,
                reserveName: this.dataForm.reserveName,
                reserveTel: this.dataForm.reserveTel,
                sourceName: this.dataForm.sourceName,
                activityId: this.dataForm.activityId,
                guaranteeType: this.dataForm.guaranteeType,
                saleId: this.dataForm.saleId,
                externalNo: this.dataForm.externalNo,
                remarks: this.dataForm.remarks,
                zc: this.dataForm.zc,
                sourceAgreenid: this.dataForm.sourceAgreenid,
                roomsNum: this.addRoomsList.length,
                roomsDays: this.dataForm.roomsDays,
                floorRooms: JSON.stringify(this.reserveList)
              })
            }).then(({
              data
            }) => {
              if (data && data.code === 0) {
                Object.assign(this.$data, this.$options.data());
                this.$cookie.set('reserve', '');
                //跳转账单界面
                this.toAccounting({
                  singleId: data.singleId
                }, '1', 2);
                this.$message({
                  message: this.$t('Common.OperationSuccessful'),
                  type: 'success',
                  duration: 1500,
                  onClose: () => {}
                });
              } else {
                this.$message.error(data.msg);
              }
            });
          }
        });
      }
    }
  };
</script>
<style lang="scss" scoped>
  .ant-card-bordered,
  .ant-card-head,
  .ant-table-bordered table,
  .ant-table-bordered td,
  .ant-table-bordered th {
    border-color: #d9e5ec !important;
  }

  .ant-card-head-wrapper {
    display: flex;
    align-items: center;
  }

  .ant-card-head-title {
    display: inline-block;
    flex: 1 1;
    padding: 8px 0;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
  }

  .ant-card-head:after {
    clear: both;
  }

  .ant-card-head:after,
  .ant-card-head:before {
    content: '';
    display: table;
  }

  .ant-card-body,
  .ant-card-wider-padding .ant-card-body {
    padding: 16px;
  }

  .ant-layout-footer {
    background: #fff;
    text-align: right;
    border-top: 1px solid #e8e8e8;
  }

  .ant-layout-footer {
    padding: 12px 24px;
    color: #002140;
    font-size: 14px;
    background: #d9e5ec;
    bottom: 0px;
    width: 100%;
    left: 0px;
  }

  .el-button+.el-button {
    margin-left: 8px;
  }

  .title_day_price {
    padding: 0 0 15px;
    border-bottom: 1px solid rgba(0, 0, 0, 0.25);
  }

  .title_day_price>.pull {
    font-weight: 700;
    margin-top: 6px;
  }

  .pull {
    float: left;
  }

  .clear_float:after {
    display: block;
    content: '';
    clear: both;
  }

  .title_day_price>.pull .in_block+.in_block {
    margin-left: 30px;
  }

  .push {
    float: right;
  }

  .in_block {
    display: inline-block;
  }

  .title_day_price>.pull .in_block>span:first-of-type {
    color: #666;
  }

  .title_day_price>.pull .in_block>span:nth-of-type(2) {
    color: #151515;
  }

  .red_color1 {
    color: #f24e4c !important;
  }

  .error_html .text {
    font-size: 14px;
    margin-top: 20px;
    margin-bottom: 20px;
  }

  .error_html {
    text-align: center;
    color: #000;
  }

  .el-form-item.in_block {
    margin-bottom: 8px;
  }

  .el-form-item {
    margin-bottom: 15px;
  }

  .add_room_cell .col_one {
    padding: 10px 0;
  }

  .push {
    float: right;
  }

  .pull {
    float: left;
  }

  .push a:hover {
    text-decoration: none;
    cursor: pointer;
  }

  .ant-divider,
  .ant-divider-vertical {
    position: relative;
    top: -0.06em;
    display: inline-block;
    width: 1px;
    height: 0.9em;
    margin: 0 8px;
    vertical-align: middle;
  }

  .ant-divider {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    color: #002140;
    font-size: 14px;
    font-variant: tabular-nums;
    line-height: 1.5;
    list-style: none;
    -webkit-font-feature-settings: 'tnum', 'tnum';
    font-feature-settings: 'tnum', 'tnum';
    background: #e8e8e8;
  }

  .pull>span,
  .add_room_cell .col_two>.pull>span {
    display: inline-block;
  }

  .pull>span+span {
    margin-left: 30px;
  }

  .customerSourceBar {
    padding: 8px 16px;
    box-shadow: 0 2px 6px 0 rgba(0, 0, 0, 0.09);
  }

  @media screen and (min-width: 1441px) {
    .customerSourceBar {
      margin-left: auto;
      margin-right: auto;
    }
  }

  .customerSourceBar>div>.in_block:nth-of-type(2) {
    width: 37%;
  }

  .customerSourceBar>div>.in_block:first-of-type {
    width: 26%;
  }

  .in_block {
    display: inline-block;
  }

  .ant-form label {
    font-size: 14px;
  }

  .ruzhu #pane-first {
    max-height: 150px;
    overflow-y: auto;
  }

  .ant-popover-inner-content {
    padding: 12px 16px;
    color: #002140;

    .table_recent_price_ul {
      max-width: 900px;

      table {
        border-collapse: collapse;
        width: 100%;

        thead,
        th,
        tr,
        tt,
        u,
        ul,
          {
          font: inherit;
          font-size: 100%;
          margin: 0;
          padding: 0;
          vertical-align: initial;
          border: 0;
        }


      }

    }

  }

  .recent_price_ul table th>.list_box>span {
    line-height: 36px;
    background: #f0f0f0;
    height: 36px;
  }

  .table_recent_price_ul.table_recent_price_ul table tbody tr td:first-of-type .list_box span {
    height: calc(100% + 1px);
  }

  .recent_price_ul table td>.list_box>span {
    height: 95px;
  }

  .recent_price_ul table td>.list_box>span,
  .recent_price_ul table th>.list_box>span {
    float: left;
    width: 150px;
    text-align: center;
    border: 1px solid rgba(0, 0, 0, .25);
    margin-left: -1px;
    margin-top: -1px;
  }

  .recent_price_ul table td:first-of-type>.list_box span>div:first-of-type,
  .recent_price_ul table td>.list_box>span>div:first-of-type {
    margin-top: 8px;
    margin-bottom: 6px;
  }

  .table_recent_price_ul.table_recent_price_ul td:nth-of-type(2) .list_box {
    max-height: 340px;
    overflow: auto;
  }
</style>
